import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { patrolrouteVO, patrolrouteForm, patrolrouteQuery } from '@/api/camera/patrolRoute/types';

/**
 * 查询巡视路线列表
 * @param query
 * @returns {*}
 */

export const listpatrolroute = (query?: patrolrouteQuery): AxiosPromise<patrolrouteVO[]> => {
  return request({
    url: '/camera/patrolRoute/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询巡视路线详细
 * @param cameraPatrolRouteId
 */
export const getpatrolroute = (cameraPatrolRouteId: string | number): AxiosPromise<patrolrouteVO> => {
  return request({
    url: '/camera/patrolRoute/' + cameraPatrolRouteId,
    method: 'get'
  });
};

/**
 * 新增巡视路线
 * @param data
 */
export const addpatrolroute = (data: patrolrouteForm) => {
  return request({
    url: '/camera/patrolRoute',
    method: 'post',
    data: data
  });
};

/**
 * 修改巡视路线
 * @param data
 */
export const updatepatrolroute = (data: patrolrouteForm) => {
  return request({
    url: '/camera/patrolRoute',
    method: 'put',
    data: data
  });
};

/**
 * 删除巡视路线
 * @param cameraPatrolRouteId
 */
export const delpatrolroute = (cameraPatrolRouteId: string | number | Array<string | number>) => {
  return request({
    url: '/camera/patrolRoute/' + cameraPatrolRouteId,
    method: 'delete'
  });
};
